//
//  UIButton+RxExtection_Kingfisher.swift
//  YKSwiftRxExtection
//
//  Created by edward on 2023/3/31.
//  Copyright © 2023 Edward（本内容遵循MIT协议）. All rights reserved.
//

import UIKit
import RxSwift
import Kingfisher

extension Reactive where Base: UIButton {
    
    public func imageUrlStr(for controlState: UIControl.State = .normal, placeHolderImage placeHolder: UIImage? = nil) -> Binder<String?> {
        Binder(self.base) { button, urlStr in
            if let url = urlStr {
                button.kf.setImage(with: URL.init(string: url), for: controlState, placeholder: placeHolder)
            }
        }
    }
}
